#include <stdio.h>
#include <stdlib.h>

#include "NUC900_GE.h"
//#include "myio.h"
#include "wbio.h"
#ifdef _NUC900_
#include "NUC900_reg.h"
#else
#include "reg702.h"
#endif

#define TOUCH_LCM 
/***************/
//#define TV_OUT 1
/***************/

#ifdef TV_OUT
#include "NUC900_vpost.h"
#endif

UINT8 _VEDIOBUFF[]={
#include "1_RGB565.DAT"
//#include "2_RGB565.dat"
};

void delay_long(UINT16 delay_cnt)
{
  UINT16 i=delay_cnt; // 40ms/10us=20000
  
  while (i--); // i=i-1 & cjne > 10us
}

#ifdef TV_OUT
INT Display_callback(UINT8 * pucBuff, UINT32 uDataLen)
{
    vpostVAStartTrigger();
    printf("VPOST ISR\n");
	return 0;
}
#endif

void init_LCM()
{

  LCDFORMATEX lcdformatex;
  UINT32 * pframbuf=NULL;
  
#ifdef TV_OUT
  UINT32	uVASrcFormat,uOSDSrcFormat, uPicWidth;

  lcdformatex.ucVASrcFormat = VA_SRC_RGB565;
  vpostLCMInit(&lcdformatex);
  pframbuf = vpostGetFrameBuffer();
  if (pframbuf==NULL)
    printf("NULL FRAME BUFFER\n");
  else
    //memcpy(pframbuf,_ucvideo_buff,sizeof(_ucvideo_buff));
    printf("frame buffer is ok");

#endif
}

